ec2a76
@@ -15,7 +15,13 @@
  */
 package org.springframework.data.redis.cache;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.commons.logging.Log;
@@ -159,7 +165,41 @@
public class RedisCacheManager extends AbstractTransactionSupportingCacheManager
 	protected Collection<? extends Cache> loadCaches() {
 
 		Assert.notNull(this.template, "A redis template is required in order to interact with data store");
-		return loadRemoteCachesOnStartup ? loadAndInitRemoteCaches() : Collections.<Cache> emptyList();
+		return addConfiguredCachesIfNecessary(loadRemoteCachesOnStartup ? loadAndInitRemoteCaches() : Collections
+				.<Cache> emptyList());
+	}
+
+	/**
+	 * Returns a new {@link Collection} of {@link Cache} from the given caches collection and adds the configured
+	 * {@link Cache}s of they are not already present.
+	 * 
+	 * @param caches must not be {@literal null}
+	 * @return
+	 */
+	private Collection<? extends Cache> addConfiguredCachesIfNecessary(Collection<? extends Cache> caches) {
+
+		Assert.notNull(caches, "Caches must not be null!");
+
+		Collection<Cache> result = new ArrayList<Cache>(caches);
+
+		for (String cacheName : getCacheNames()) {
+
+			boolean configuredCacheAlreadyPresent = false;
+
+			for (Cache cache : caches) {
+
+				if (cache.getName().equals(cacheName)) {
+					configuredCacheAlreadyPresent = true;
+					break;
+				}
+			}
+
+			if (!configuredCacheAlreadyPresent) {
+				result.add(getCache(cacheName));
+			}
+		}
+
+		return result;
 	}
 
 	private Cache createAndAddCache(String cacheName) {
@@ -195,8 +235,8 @@
public class RedisCacheManager extends AbstractTransactionSupportingCacheManager
 				}
 			}
 		} catch (Exception e) {
-			if(logger.isWarnEnabled()){
-				logger.warn("Failed to initialize cache with remote cache keys.",e);
+			if (logger.isWarnEnabled()) {
+				logger.warn("Failed to initialize cache with remote cache keys.", e);
 			}
 		}
 
